package com.pwx.student.web.controller;


import com.pwx.student.common.ResponseResult;
import com.pwx.student.service.IRcTeacherService;
import com.pwx.student.utils.TokenUtils;
import com.pwx.student.vo.input.CourseInputVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author saber
 * @since 2022-10-24
 */
@RestController
@RequestMapping("/rc-teacher")
public class RcTeacherController {

    @Autowired
    private IRcTeacherService iRcTeacherService;

    @PostMapping("/getStudentScore")
    public ResponseResult getStudentScore(CourseInputVo inputVo, HttpServletRequest request){
        String authorization = request.getHeader("Authorization");

        Integer teacherId = Integer.parseInt((String)TokenUtils.parseToken(authorization).get("jti"));

        inputVo.setUserId(teacherId);
        return iRcTeacherService.getStudentScore(inputVo);
    }


}
